package org.dropme;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Date;

import org.apache.http.client.ClientProtocolException;
import org.dropme.dao.LitterDao;
import org.dropme.model.Litter;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class EntryPointActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.entry_point_activity);
        Button button = (Button) findViewById(R.id.test); 
        button.setOnClickListener(new OnClickListener() {
			
			public void onClick(View arg0) {
				LitterDao dao = new LitterDao();
				Litter litter = new Litter("meh", "meh, blah blah", new Date(), "user", -3d, -40d);
				try {
					if(dao.write(litter)) {
						Toast.makeText(EntryPointActivity.this, "OK", 200).show();
					} else {
						Toast.makeText(EntryPointActivity.this, "Error", 200).show();
					}
				} catch (Exception e) {
					Toast.makeText(EntryPointActivity.this, e.getMessage(), 200).show();
				}
			}
		});
    }
}